﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using xKnight.Analyzing.Csrf;
using xKnight.Analyzing.EncodedXss;
using xKnight.Analyzing.SimpleXss;
using xKnight.Attacking;
using xKnight.Models;

namespace xKnight.Analyzing
{
    internal class AnalyzerFactory
    {
        internal static Analyzer CreateAnalyzer(Attack attack)
        {
            AttackType attackType = (AttackType)attack.AttackType;

            if (attackType == AttackType.SimpleXss)
            {
                return new SimpleXssAnalyzer(attack);
            }

            if (attackType == AttackType.EncodedXss)
            {
                return new EncodedXssAnalyzer(attack);
            }

            if (attackType == AttackType.CSRF)
            {
                return new CsrfAnalyzer(attack);
            }

            throw new InvalidDataException("invalid attack type");
        }
    }
}
